#!/bin/bash
# ***************************************************************
# *                    simula.plus@cemes.fr                     *
# *	              GNU/linux version 3.0.0                   *
# *            software under General Public License            *
# ***************************************************************
# * copyright © 2003,2004,2005,2006,2007,2011,2012 COLLARD Christophe
# * copyright © 2003,2004,2005,2006,2007,2011,2012 Centre National de la Recherche Scientifique
# * copyright © 2003,2004,2005,2006,2007 Arts et Métiers ParisTech
# * copyright © 2003,2004,2005,2006,2007 Université de Valenciennes et du Hainaut-Cambrésis
# * copyright © 2003,2004,2005,2006,2007 Laboratoire de Physique et Mécanique des Matériaux (LPMM - CNRS)
# * copyright © 2003,2004,2005,2006,2007 Laboratoire de Mathématiques et ses Applications de Valenciennes (LAMAV)
# * copyright © 2011,2012 Centre d'Elaboration de Matériaux et d'Etudes Structurales (CEMES - CNRS)
# * copyright © 2011 Laboratoire d'Etude des Microstructures et de Mécanique des Matériaux (LEM3 - CNRS)
# ***************************************************************/

#    run MateriOL++ belongs to Materials Object Libraries (MateriOL++) </br>
#    MateriOL++ is part of Simula+ <br><br>
#
#    Simula+ is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version. <br><br>
#
#    Simula+ is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details. <br><br>
#
#    You should have received a copy of the GNU General Public License
#    along with Simula+; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA


# color definition
GREEN="\\033[1;32m"
NORMAL="\\033[0;39m"
RED="\\033[1;31m"
PINK="\\033[1;35m"
BLUE="\\033[1;34m"
WHITE="\\033[0;02m"
LIGHTWHITE="\\033[1;08m"
YELLOW="\\033[1;33m"
CYAN="\\033[1;36m"


# checks Simula+ has been started correctly
if [ "$rat" != "true" ]; then
    echo -e $RED"Please, configure & execute 'run simula+ tests' to start tests"$NORMAL
    exit
fi


cd MateriOL++
if [ -f MateriOL++.exe ]; then 
    rm MateriOL++.exe
fi
$compiler -fpermissive -w -I $SimulaPlus -o MateriOL++.exe tests-MateriOL++.cpp
if [ -f MateriOL++.exe ]; then 
     ./MateriOL++.exe
     rm MateriOL++.exe
     rm *.res
else if [ -f ../simula+.old ]; then
        mv -f ../simula+.old ../simula+.bak
     fi
fi
cd ..
